<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1 id="demo">老婆跟别人跑了</h1>
    <p>点击按钮添加颜色</p>
    <button onclick="myFunc()">Click</button>
    <script>
        function myFunc() {
            document.getElementById("demo").style.color = "green";
        }
    </script>
</body>

</html>